<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>供需对接服务系统--项目列表</title>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/supplier/common/css/style.css"/>
    <!--Layui-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--extended-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--公用样式JS-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${re.contextPath}/pageoffice.js" id="po_js_main"></script>
</head>
<style>
    .Right {
        width: 100%;
        overflow-y: auto;
    }

    .widthle {
        width: 50%;
    }

    .widinput {
        width: 42% !important;
    }

    .layui-table-cell {
        text-align: center;
        font-size: 14px;
        padding: 0 5px;
        height: auto;
        overflow: visible;
        text-overflow: inherit;
        white-space: normal;
        word-break: break-all;
    }
</style>

<body>
<!--头部-->

<!--容器-->
<div class="container clearfix">
    <!--右侧内容-->
    <div class="Right fr mt10">
        <div class="screening screeningOne whitebg clearfix">
            <form id="query-form">
                <ul class="clearfix fl" style="width: 100%;">
                    <li style="width: 20%;">
                        <label class="fl widthle">合同名称:</label>
                        <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="htmc" id="htmc"
                               autocomplete="off">
                    </li>
                    <li style="width: 20%;">
                        <label class="fl widthle">合同编号:</label>
                        <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="htbh" id="htbh"
                               autocomplete="off" placeholder="全部">
                    </li>
                    <li style="width: 20%;">
                        <label class="fl widthle">合同类型:</label>
                        <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="htlx" id="htlx"
                               autocomplete="off" placeholder="全部">
                    </li>
                    <li style="width: 36%;">
                        <label class="fl" style="width: 20%;">签订时间:</label>
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="startDate" id="startDate"
                               autocomplete="off" placeholder="开始时间">
                        至
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="endDate" id="endDate"
                               autocomplete="off" placeholder="结束时间">
                    </li>
                    <li style="width: 20%;">
                        <label class="fl widthle">是否有首付款:</label>
                        <select name="sfysfk" id="sfysfk" class="widinput">
                            <option value="">全部</option>
                            <option value="0">是</option>
                            <option value="1">否</option>
                        </select>
                    </li>
                    <li style="width: 36%;">
                        <label class="fl" style="width: 20%;">合同金额(元):</label>
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="htmin" id="htmin"
                               autocomplete="off" placeholder="最小值">
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="htmax" id="htmax"
                               autocomplete="off" placeholder="最大值">
                    </li>
                    <li style="width: 36%;">
                        <label class="fl" style="width: 20%;">项目投资额(元):</label>
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="xmmin" id="xmmin"
                               autocomplete="off" placeholder="最小值">
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="xmmax" id="xmmax"
                               autocomplete="off" placeholder="最大值">
                    </li>
                </ul>

                <ul class="clearfix fl mt10" style="width: 100%;">

                    <li style="width: 36%;">
                        <label class="fl" style="width: 20%;">工期:</label>
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="gqmin" id="gqmin"
                               autocomplete="off" placeholder="最小值">
                        <input type="text" style="border: 1px solid #DDDDDD;width: 30%;" name="gqmax" id="gqmax"
                               autocomplete="off" placeholder="最大值">
                    </li>
                    <li style="width: 20%;">
                        <label class="fl widthle">行业:</label>
                        <input type="text" class="widinput" style=";border: 1px solid #DDDDDD" name="hy" id="hy"
                               autocomplete="off">
                    </li>
                    <li style="width: 20%;">
                        <label class="fl widthle">申请人:</label>
                        <input type="text" class="widinput" style=";border: 1px solid #DDDDDD" name="sqr" id="sqr"
                               autocomplete="off">
                    </li>
                    <li style="width: 20%;">
                        <label class="fl widthle">项目名称:</label>
                        <input type="text" class="widinput" style=";border: 1px solid #DDDDDD" name="xmmc" id="xmmc"
                               autocomplete="off">
                    </li>

                </ul>
                <ul class="clearfix fl mt10" style="width: 100%;">
                    <li style="width: 20%;">
                        <label class="fl widthle">客户名称:</label>
                        <input type="text" class="widinput" style=";border: 1px solid #DDDDDD" name="khmc" id="khmc"
                               autocomplete="off">
                    </li>
                    <li style="width: 20%;text-align: center;float: right;">
                        <button type="button" class="layui-btn layui-btn-normal" style="width: 65px;height: 40px;"
                                onclick="query()">筛选
                        </button>
                        <button type="button" class="layui-btn layui-btn-normal"
                                style="width:65px; height:40px;background-color: #FF5722;" onclick="resetQurey()">重置
                        </button>
                    </li>
                </ul>
            </form>
        </div>

        <div class="project whitebg">
            <div style=" height: 50px;margin-top: 10px;">
                <@shiro.hasPermission name="search:export">
                    <input class="layui-btn layui-btn-normal layui-btn-sm fr ml10" type="button" value="导出Excel"
                           onclick="exportTable()">
                </@shiro.hasPermission>
                <@shiro.hasPermission name="search:view">
                    <input class="layui-btn layui-btn-danger layui-btn-sm fr" type="button" value="预览Excel"
                           onclick="viewTable()">
                </@shiro.hasPermission>
            </div>
            <table id="tableList" class="layui-hide" lay-filter="tableList"></table>
        </div>
    </div>
    <form class="layui-form" id="test" style="display:none; margin-top: 22px;">
        <table class="layui-hide" style="clear:both;" id="lalala" lay-filter="lalala"></table>
    </form>
</div>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/tabs.js"></script>
<script type="text/javascript">
    var layer;
    var form = layui.form;
    var table = null;
    var tableIns = null;
    //注意进度条依赖 element 模块，否则无法进行正常渲染和功能性操作
    var element = "";
    layui.use('element', function () {
        element = layui.element;


    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#beginDate' //指定元素
        });
        laydate.render({
            elem: '#endDate' //指定元素
        });
    });

    function queryData() {
        // 项目归属
        var htmc = $('#htmc').val();
        var htbh = $('#htbh').val();
        var htlx = $('#htlx').val();
        var startDate = $('#startDate').val();
        var endDate = $('#endDate').val();
        var sfysfk = $('#sfysfk').val();
        var htmin = $('#htmin').val();
        var htmax = $('#htmax').val();
        var xmmin = $('#xmmin').val();
        var xmmax = $('#xmmax').val();
        var gqmin = $('#gqmin').val();
        var gqmax = $('#gqmax').val();
        var hy = $('#hy').val();
        var sqr = $('#sqr').val();
        var xmmc = $('#xmmc').val();
        var khmc = $('#khmc').val();

        var jsondata = {
            htmc: htmc,
            htbh: htbh,
            htlx: htlx,
            startDate: startDate,
            endDate: endDate,
            sfysfk: sfysfk,
            htmin: htmin,
            htmax: htmax,
            xmmin: xmmin,
            xmmax: xmmax,
            gqmin: gqmin,
            gqmax: gqmax,
            hy: hy,
            sqr: sqr,
            xmmc: xmmc,
            khmc: khmc
        };
        return jsondata;
    }

    function query() {
        var jsondata = queryData();
        table.reload('tableList', {where: jsondata});
    }

    function resetQuery() {
        document.getElementById('query-form').reset();
        // var jsondata = queryData();
        // table.reload('tableList', {where: jsondata});
    }

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startDate' //指定元素
        });
        laydate.render({
            elem: '#endDate' //指定元素
        });
    });

    layui.use('table', function () {
        table = layui.table;
        element = element;
        //方法级渲染
        tableIns = table.render({
            id: 'tableList',
            elem: '#tableList',
            url: '/search/buProjectInfo/showOaDataListAll',
            height: "auto",
            page: true,
            cols: [[
                {
                    title: '序号', width: '10%', rowspan: 2, templet: function (res) {
                        return res.LAY_INDEX;
                    }
                },
                {field: 'id', align: 'center', title: '申请人（销售人员）', rowspan: 2, hide: true, width: 200},
                {field: 'type', align: 'center', title: '申请人（销售人员）', rowspan: 2, hide: true, width: 200},
                {field: 'sqr', align: 'center', title: '申请人（销售人员）', rowspan: 2, width: 200},
                {field: 'gq', align: 'center', title: '工期', rowspan: 2, width: 200},
                {field: 'htmc', align: 'center', title: '合同名称', rowspan: 2, width: 200},
                {field: 'ydtj', align: 'center', title: '约定条件', rowspan: 2, width: 200},
                {field: 'ssfb', align: 'center', title: '所属分部', rowspan: 2, width: 200},
                {field: 'qdbm', align: 'center', title: '签订部门', rowspan: 2, width: 200},
                {field: 'yq', align: 'center', title: '延期', rowspan: 2, width: 200},
                {field: 'xzqy', align: 'center', title: '区域', rowspan: 2, width: 200},
                {field: 'htje', align: 'center', title: '合同金额（元）', rowspan: 2, width: 200},
                {field: 'khmc', align: 'center', title: '客户名称', rowspan: 2, width: 200},
                {field: 'khlxr', align: 'center', title: '客户联系人', rowspan: 2, width: 200},
                {field: 'khlxfs', align: 'center', title: '客户联系方式', rowspan: 2, width: 200},
                {field: 'sfbz', align: 'center', title: '合同额或取费比例', rowspan: 2, width: 200},
                {field: 'htqdrq', align: 'center', title: '签订时间', rowspan: 2, width: 200},
                {field: 'ssdwmc', align: 'center', title: '实施单位信息', rowspan: 2, width: 200},
                {field: 'htbh', align: 'center', title: '合同编号', rowspan: 2, width: 200},
                {field: 'sfk', align: 'center', title: '首付款(元)', rowspan: 2, width: 200},
                {field: 'xmtze', align: 'center', title: '项目投资额（元）', rowspan: 2, width: 200},
                {field: 'ywlx', align: 'center', title: '业务类型', rowspan: 2, width: 200},
                {field: 'hy', align: 'center', title: '是否有首付款', rowspan: 2, width: 200},
                {field: 'sjssr', align: 'center', title: '行业', rowspan: 2, width: 200},
                {field: 'sfysfk', align: 'center', title: '项目实际实施人', rowspan: 2, width: 200},
                {field: 'xmmc', align: 'center', title: '项目名称', rowspan: 2, width: 200},
                {field: 'xmzj', align: 'center', title: '监理项目总监', rowspan: 2, width: 200},
                {field: 'xmzd', align: 'center', title: '监理项目总代', rowspan: 2, width: 200},
                {field: 'jlgcs', align: 'center', title: '监理工程师', rowspan: 2, width: 200},
                {field: 'zxxmzj', align: 'center', title: '咨询项目经理', rowspan: 2, width: 200},
                {field: 'zxxmzd', align: 'center', title: '高级咨询顾问', rowspan: 2, width: 200},
                {field: 'zxjlgcs', align: 'center', title: '咨询项目组成员', rowspan: 2, width: 200},
                {field: 'jcjsfzr', align: 'center', title: '检测技术负责人', rowspan: 2, width: 200},
                {field: 'jcxmjl', align: 'center', title: '检测项目经理', rowspan: 2, width: 200},
                {field: 'jcxmzcy', align: 'center', title: '检测项目组成员', rowspan: 2, width: 200},
                {field: 'htzt', align: 'center', title: '合同状态', rowspan: 2, width: 200},
                {field: 'as qddd', align: 'center', title: '合同签订地省市区', rowspan: 2, width: 200},
                {field: 'xmbh', align: 'center', title: '项目编号', rowspan: 2, width: 200},
                {field: 'frqz', align: 'center', title: '法人签字', rowspan: 2, width: 200},
                {field: 'htlx', align: 'center', title: '合同类型', rowspan: 2, width: 200},
                {field: 'fs', align: 'center', title: '签章份数', rowspan: 2, width: 200},
                {field: 'qzlx', align: 'center', title: '签章类型', rowspan: 2, width: 200},
                {field: 'scfj', align: 'center', title: '上传附件', rowspan: 2, width: 200},
                {field: 'sjmc', align: 'center', title: '商机名称', rowspan: 2, width: 200},
                {field: 'as fwfw', align: 'center', title: '服务范围', rowspan: 2, width: 200},
                {field: 'qfz', align: 'center', title: '骑缝章', rowspan: 2, width: 200},
                {field: 'frz', align: 'center', title: '法人章', rowspan: 2, width: 200},
                {field: 'lcbh', align: 'center', title: '流程编号', rowspan: 2, width: 200},
                {field: 'sqrq', align: 'center', title: '申请日期', rowspan: 2, width: 200},
                {field: 'ybtk', align: 'center', title: '一般条款', rowspan: 2, width: 200},
                {field: 'gz', align: 'center', title: '公章', rowspan: 2, width: 200},
                {field: 'htz', align: 'center', title: '合同章', rowspan: 2, width: 200},
                {field: 'fl', align: 'center', title: '费率', rowspan: 2, width: 200},
                {field: 'gcjygs', align: 'center', title: '工程简要概述', rowspan: 2, width: 200},
                {field: 'ryqk', align: 'center', title: '合同注明的人员情况', rowspan: 2, width: 200},
                {field: 'gxr', align: 'center', title: '共享人', rowspan: 2, width: 200},
                {field: 'jsfs', align: 'center', title: '监理费计算方式', rowspan: 2, width: 200},
                {field: 'zbsc', align: 'center', title: '质保时长', rowspan: 2, width: 200},
                {field: 'fxxz', align: 'center', title: '分项选择', rowspan: 2, width: 200},
                {field: 'fenlei', align: 'center', title: '分类', rowspan: 2, width: 200},
                {field: 'jlfkqk', align: 'center', title: '监理付款情况', rowspan: 2, width: 200},
                {field: 'zxfkqk', align: 'center', title: '咨询付款情况', rowspan: 2, width: 200},
                {field: 'jcfkqk', align: 'center', title: '检测付款情况', rowspan: 2, width: 200},
                {align: 'center', title: '监理费用总计', colspan: 3, width: 200, colGroup: true},
                {align: 'center', title: '咨询费用总计', colspan: 3, width: 200},
                {align: 'center', title: '检测费用总计', colspan: 3, width: 200}
            ],
                [
                    {
                        field: 'jlhte',
                        align: 'center',
                        title: '监理合同额（元）',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.jlhte == null || d.jlhte == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.jlhte;
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.jlhte;
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jlhte;
                                } else {
                                    return d.jlhte;
                                }
                            }
                        }
                    },
                    {
                        field: 'jlyhkje',
                        align: 'center',
                        title: '已回款合计(元)',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.jlyhkje == null || d.jlyhkje == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.jlyhkje;
                                    // return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.jlyhkje + "元</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.jlyhkje;
                                    // return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.jlyhkje + "元</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jlyhkje;
                                    // return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jlyhkje + "元</a>";
                                } else {
                                    return d.jlyhkje;
                                }
                            }
                        }
                    },
                    {
                        field: 'jlyhkbl',
                        align: 'center',
                        title: '已回款比例',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.jlyhkbl == null || d.jlyhkbl == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jlyhkbl + "</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jlyhkbl + "</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jlyhkbl + "</a>";
                                } else {
                                    return d.jlyhkbl;
                                }
                            }
                        }
                    },
                    {
                        field: 'zxhte',
                        align: 'center',
                        title: '咨询合同额（元）',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.zxhte == null || d.zxhte == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.zxhte + "元</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.zxhte + "元</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.zxhte + "元</a>";
                                } else {
                                    return d.jlhte;
                                }
                            }
                        }
                    },
                    {
                        field: 'zxyhkje',
                        align: 'center',
                        title: '已回款合计(元)',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.zxyhkje == null || d.zxyhkje == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.zxyhkje + "元</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.zxyhkje + "元</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.zxyhkje + "元</a>";
                                } else {
                                    return d.jlyhkje;
                                }
                            }
                        }
                    },
                    {
                        field: 'zxyhkbl',
                        align: 'center',
                        title: '已回款比例',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.zxyhkbl == null || d.zxyhkbl == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.zxyhkbl + "</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.zxyhkbl + "</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.zxyhkbl + "</a>";
                                } else {
                                    return d.jlyhkbl;
                                }
                            }
                        }
                    },
                    {
                        field: 'jchte',
                        align: 'center',
                        title: '检测合同额（元）',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.jchte == null || d.jchte == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.jchte + "元</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.jchte + "元</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jchte + "元</a>";
                                } else {
                                    return d.jlyhkje;
                                }
                            }
                        }
                    },
                    {
                        field: 'jcyhkje',
                        align: 'center',
                        title: '已回款合计(元)',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {
                            if (d.jcyhkje == null || d.jcyhkje == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'监理\')\">" + d.jcyhkje + "元</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'咨询\')\">" + d.jcyhkje + "元</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jcyhkje + "元</a>";
                                } else {
                                    return d.jlyhkje;
                                }
                            }
                        }
                    },
                    {
                        field: 'jcyhkbl',
                        align: 'center',
                        title: '已回款比例',
                        rowspan: 1,
                        width: 200,
                        templet: function (d) {

                            if (d.jcyhkbl == null || d.jcyhkbl == "") {
                                return "";
                            } else {
                                if (d.type == 'jl') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jcyhkbl + "</a>";
                                } else if (d.type == 'zx') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jcyhkbl + "</a>";
                                } else if (d.type == 'jc') {
                                    return "<a href=\"javascript:void(0);\" style=\"color: #0D9BFF\" onclick=\"openTc(\'" + d.id + "\',\'" + d.htmc + "\',\'检测\')\">" + d.jcyhkbl + "</a>";
                                } else {
                                    return d.jlyhkbl;
                                }
                            }
                        }
                    }
                ]],
            done: function (res, currentCount) {
                //***重点***：table渲染完成后渲染element进度条
                element.render();
                $(".layui-table-page select").css("width", "80px");

            }
        });
    });

    //导出excel
    function exportTable() {
        var htmc = $('#htmc').val();
        var htbh = $('#htbh').val();
        var htlx = $('#htlx').val();
        var startDate = $('#startDate').val();
        var endDate = $('#endDate').val();
        var sfysfk = $('#sfysfk').val();
        var htmin = $('#htmin').val();
        var htmax = $('#htmax').val();
        var xmmin = $('#xmmin').val();
        var xmmax = $('#xmmax').val();
        var gqmin = $('#gqmin').val();
        var gqmax = $('#gqmax').val();
        var hy = $('#hy').val();
        var sqr = $('#sqr').val();
        var xmmc = $('#xmmc').val();
        var khmc = $('#khmc').val();
        var url = '/search/buProjectInfo/exportExcel?htmc=' + htmc + '&htbh=' + htbh + '&htlx=' + htlx + '&startDate=' + startDate + '&endDate=' + endDate + '&sfysfk=' + sfysfk + '&htmin=' + htmin + '&htmax=' + htmax + '&xmmin=' + xmmin + '&xmmax=' + xmmax + '&gqmin=' + gqmin + '&gqmax=' + gqmax + '&hy=' + hy + '&sqr=' + sqr + '&xmmc=' + xmmc + '&khmc=' + khmc;
        location.href = url;
    }


    //预览excel
    function viewTable() {
        var jsondata = queryData();
        layerAjax('/search/buProjectInfo/viewTableHt', jsondata, '', function (d) {
            if (d.flag) {
                if (d.data) {
                    var w = ($(window).width() * 0.8);
                    var h = ($(window).height() * 0.8);
                    POBrowser.openWindowModeless('/sys/office/openwordTemp?ft=1&fid=' + d.data, 'width=1200px;height=800px;', '{}')
                }
            } else {
                layer.msg(d.msg, {icon: 2});
            }
            console.log(d);
        });
    }

    function openTc(id, name, title) {
        hkRenderTable(id, title);
        layer.open({
            type: 1,
            area: ['70%', '90%'],
            title: name + '-' + title + '付款情况',
            content: $("#test"),
            shade: 0,
            cancel: function (layero, index) {
                layer.closeAll();
            }

        });
    }

    function hkRenderTable(id, name) {
        layui.use(['table'], function () {
            table = layui.table;
            table.render({
                elem: '#lalala',
                id: 'lalala',
                cellMinWidth: 80,
                url: "/search/buProjectInfo/queryPayMode?id=" + id + "&type=" + name,
                height: 600,
                cols: [[
                    {field: 'jhDate', align: 'center', title: '计划付款时间', sort: false, width: 300},
                    {field: 'badtName', align: 'center', title: '付款方式', sort: false, width: 300},
                    {field: 'payMoney', align: 'center', title: '计划付款金额（元）', sort: false, width: 300},
                    {field: 'sppPersent', align: 'center', title: '计划付款比例', sort: false, width: 300,},
                    {
                        field: 'arrivalDate',
                        align: 'center',
                        title: '实际付款时间',
                        sort: false,
                        width: 300,
                        templet: function (d) {
                            if (d.arrivalDate != "" && d.arrivalDate != null) {
                                var str = "";
                                var arr = d.arrivalDate.split(",");
                                for (var x = 0; x < arr.length; x++) {
                                    var money = arr[x];
                                    if (arr.length == 1) {
                                        str = "<div>首次付款时间:" + money + "</div>";
                                    } else {
                                        var alb = NumberToChinese(x + 1);
                                        if (x == 0) {
                                            str = "<div>首次付款时间:" + money + "</div>";
                                        } else if (x != arr.length - 1) {

                                            str += "<div>第" + alb + "次付款时间:" + money + "</div>";
                                        } else {
                                            str += "<div>第" + alb + "次付款时间:" + money + "</div>";
                                        }
                                    }
                                }
                                return str;
                            } else {
                                return "";
                            }
                        }
                    },
                    {
                        field: 'arrivalMoney',
                        align: 'center',
                        title: '实际付款金额（元）',
                        sort: false,
                        width: 300,
                        templet: function (d) {
                            if (d.arrivalMoney != "" && d.arrivalMoney != null) {
                                var str = "";
                                var arr = d.arrivalMoney.split(",");
                                for (var x = 0; x < arr.length; x++) {
                                    var money = arr[x];
                                    if (arr.length == 1) {
                                        str = "<div>首次付款金额:" + money + "</div>";
                                    } else {
                                        var alb = NumberToChinese(x + 1);
                                        if (x == 0) {
                                            str = "<div>首次付款金额:" + money + "</div>";
                                        } else if (x != arr.length - 1) {

                                            str += "<div>第" + alb + "次付款金额:" + money + "</div>";
                                        } else {
                                            str += "<div>第" + alb + "次付款金额:" + money + "</div>";
                                        }
                                    }
                                }
                                return str;
                            } else {
                                return "";
                            }
                        },
                        templet: function (d) {
                            if (d.arrivalMoney != "" && d.arrivalMoney != null) {
                                var str = "";
                                var arr = d.arrivalMoney.split(",");
                                for (var x = 0; x < arr.length; x++) {
                                    var money = arr[x];
                                    if (arr.length == 1) {
                                        str = "<div>首次付款金额:" + money + "</div>";
                                    } else {
                                        var alb = NumberToChinese(x + 1);
                                        if (x == 0) {
                                            str = "<div>首次付款金额:" + money + "</div>";
                                        } else if (x != arr.length - 1) {

                                            str += "<div>第" + alb + "次付款金额:" + money + "</div>";
                                        } else {
                                            str += "<div>第" + alb + "次付款金额:" + money + "</div>";
                                        }
                                    }
                                }
                                return str;
                            } else {
                                return "";
                            }
                        }
                    }
                ]],
            });
        })
    }

    var chnNumChar = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
    var chnUnitSection = ["", "万", "亿", "万亿", "亿亿"];
    var chnUnitChar = ["", "十", "百", "千"];

    function SectionToChinese(section) {
        var strIns = '', chnStr = '';
        var unitPos = 0;
        var zero = true;
        while (section > 0) {
            var v = section % 10;
            if (v === 0) {
                if (!zero) {
                    zero = true;
                    chnStr = chnNumChar[v] + chnStr;
                }
            } else {
                zero = false;
                strIns = chnNumChar[v];
                strIns += chnUnitChar[unitPos];
                chnStr = strIns + chnStr;
            }
            unitPos++;
            section = Math.floor(section / 10);
        }
        return chnStr;
    }

    function NumberToChinese(num) {
        var unitPos = 0;
        var strIns = '', chnStr = '';
        var needZero = false;
        if (num === 0) {
            return chnNumChar[0];
        }
        while (num > 0) {
            var section = num % 10000;
            if (needZero) {
                chnStr = chnNumChar[0] + chnStr;
            }
            strIns = SectionToChinese(section);
            strIns += (section !== 0) ? chnUnitSection[unitPos] : chnUnitSection[0];
            chnStr = strIns + chnStr;
            needZero = (section < 1000) && (section > 0);
            num = Math.floor(num / 10000);
            unitPos++;
        }
        return chnStr;
    }
</script>
</body>

</html>
